//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    longitude: '',
    latitude: '',
    controls: [
      {
        id: 1,
        iconPath: '/images/pin.png',
        position: {
          left: (app.globalData.windowWidth / 2) - 16,
          top: ((app.globalData.windowHeight - 30) / 2) - 15.5,
          width: 31,
          height: 31
        },
        clickable: true
      },
      {
        id: 2,
        iconPath: '/images/center.png',
        position: {
          left: 20,
          top: app.globalData.windowHeight - 90,
          width: 31,
          height: 31
        },
        clickable: true
      }
    ]
  },
  //钩子函数
  onLoad: function (params) {
    var id = params.id;
    this.setData({
      get: postsData.postList,
      data: postsData.postList.find(m => m.id == id).content
    })
  },
  constroltap(){
    this.mapCtx.moveToLocation()
  },
  onReady (e) {
    this.mapCtx = wx.createMapContext('map')
  },
  onShow() {
    this.getLocation()
  },
  getLocation() {
    wx.getLocation({
      type: 'gcj02',
      success: this.handleGetLocationSuc.bind(this)
    })
  },
  handleGetLocationSuc(res) {
    console.log(res);
    this.setData({
      longitude: res.longitude,
      latitude: res.latitude
    })
  },
  onShareAppMessage(res) {
    return {
      title: '群英汇会议服务平台',
      path: '/page/index/index'
    }
  }
})
